public class Loom {

	public int elupunktid;
	public int max_elupunktid;
	public String nimi;
	public int dam1;
	public int dam2;
	public int ID;
	public int team;
	public boolean is_AI;
	public int erinevaid_loomatyype = 13;
	public int type;
	private int xStart; // looma displaymise x algusekordinaat
	private int yStart; // looma displaymise y algusekordinaat
	private int xEnd; // looma displaymise x lopukordinaat
	private int yEnd; // looma displaymise y lopukordinaat

	public Loom() {
		suva_statsid();
	}
	public Loom(String nimi, int nr, boolean isAI, int team_nr) {

		if (nimi == null) {

			int random_nimi = (int) (Math.random() * erinevaid_loomatyype) + 1;
			setType(random_nimi);
			this.nimi = nimi + " " + nr;
		}
		
		this.ID = nr;
		this.is_AI = isAI;
		this.team = team_nr;
		suva_statsid();
	}
	
	public void copy_loom (Loom loom_sisse) {
		this.elupunktid = loom_sisse.elupunktid;
		this.nimi = loom_sisse.nimi;
		this.dam1 = loom_sisse.dam1;
		this.dam2 = loom_sisse.dam2;
		this.ID = loom_sisse.ID;
		this.team = loom_sisse.team;
		this.is_AI = loom_sisse.is_AI;
		this.type = loom_sisse.type;
	}
	
	public void suva_statsid() {
		
		this.dam1 = 4 + ((int) (Math.random() * 6));
		this.dam2 = this.dam1 + ((int) (Math.random() * 6));
			
		this.elupunktid = 30;
		this.max_elupunktid = 30;
		
		// some stupid default values, that will be overwritten when monster is actually drawn on board
		this.setxEnd(0);
		this.setxStart(0);
		this.setyEnd(0);
		this.setyStart(0);
		
	}

	public void setType(int type_sisse) {
		this.nimi = returnAnyType(type_sisse);
		this.type=type_sisse;	
	}
	
	public void setType(String type_sisse) {
		this.nimi = type_sisse;
		if (type_sisse.contains("draakon")) {
			this.type = 1;
		}
		if (type_sisse.contains("karubeebi")) {
			this.type = 2;
		}
		if (type_sisse.contains("koaala")) {
			this.type = 3;
		}
		if (type_sisse.contains("l6vi")) {
			this.type = 4;
		}
		if (type_sisse.contains("mammut")) {
			this.type = 5;
		}
		if (type_sisse.contains("metssiga")) {
			this.type = 6;
		}
		if (type_sisse.contains("nirk")) {
			this.type = 7;
		}
		if (type_sisse.contains("orav")) {
			this.type = 8;
		}
		if (type_sisse.contains("orav2")) {
			this.type = 9;
		}
		if (type_sisse.contains("panda")) {
			this.type = 10;
		}
		if (type_sisse.contains("part")) {
			this.type = 11;
		}
		if (type_sisse.contains("pruun_hiir")) {
			this.type = 12;
		}
		if (type_sisse.contains("rebane")) {
			this.type = 13;
		}
	}
	
	public String returnAnyType(int sisse_type) {
		switch (sisse_type) {
		case 1:
			return "draakon";
		case 2:
			return "karubeebi";

		case 3:
			return "koaala";

		case 4:
			return "l6vi";

		case 5:
			return "mammut";

		case 6:
			return "metssiga";
		case 7:
			return "nirk";

		case 8:
			return "orav";

		case 9:
			return "orav2";

		case 10:
			return "panda";
		case 11:
			return "part";
		case 12:
			return "pruun_hiir";
		case 13:
			return "rebane";
		default:
			return "question";
		}	
	}
	
	
	
	
	public String getType() {
		
		return returnAnyType(this.type);
		
	} // end getType

	public void setCords (int xStart,int yStart, int xEnd,int yEnd) {
		this.xStart = xStart;
		this.yStart = yStart;
		this.xEnd = xEnd;
		this.yEnd = yEnd;
	}
	
	public void setxStart(int xStart) {
		this.xStart = xStart;
	}

	public int getxStart() {
		return xStart;
	}

	public void setyStart(int yStart) {
		this.yStart = yStart;
	}

	public int getyStart() {
		return yStart;
	}

	public void setxEnd(int xEnd) {
		this.xEnd = xEnd;
	}

	public int getxEnd() {
		return xEnd;
	}

	public void setyEnd(int yEnd) {
		this.yEnd = yEnd;
	}

	public int getyEnd() {
		return yEnd;
	}

}
